package top.yaofengqiao.springcloudsimple.payment.biz.domain.pay.model.valobj;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author yfq
 * @date 2024/6/14 17:45
 * @description
 */
@Getter
@AllArgsConstructor
public enum PaymentOrderStatus {
    CREATE(0, "已创建"),
    TRADING(1, "交易中"),
    SUCCESS(2, "交易成功"),
    FAIL(3, "交易失敗"),
    REFUND(4, "已退款 "),
    ;

    private final int status;

    private final String desc;

    public static PaymentOrderStatus determinePaymentOrderStatus(int status) {
        for (PaymentOrderStatus value : PaymentOrderStatus.values()) {
            if (value.getStatus() == status) return value;
        }

        return null;
    }

}
